﻿using BySoft.Server.Business.UserCode;
using BySoft.Server.Common;
using BySoft.Server.Common.Entity;
using BySoft.Web.Utility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BySoft.Web.Site.ComPage
{
    public partial class ViewScheduleMat : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hdWorkOrderNo.Value = UIHelper.GetQueryStringValue("workorderno");
                hdNums.Value = UIHelper.GetQueryStringValue("nums");
                BindData();
            }
        }

        private void BindData()
        {
            DataTable dt = BsScheduleBusniess.GetBomDetailByWorkOrderNo(hdWorkOrderNo.Value.Trim());
            dt.Columns.Add("TotalNum");
            dt.Columns.Add("TotalWeight");
            foreach (DataRow dr in dt.Rows)
            {
                dr["TotalNum"] = CommonMethod.ConvertToDecimal(dr["MMNumber"]) * CommonMethod.ConvertToDecimal(hdNums.Value.Trim());
                dr["TotalWeight"] = CommonMethod.ConvertToDecimal(dr["SingleWeight"]) * CommonMethod.ConvertToDecimal(hdNums.Value.Trim()); ;
            }
            grdResult.DataSource = dt;
            grdResult.DataBind();
        }
    }
}